﻿<local:NumericSpinnerControlBase x:Class="Atdl4net.Wpf.View.Controls.DoubleSpinner"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Atdl4net.Wpf.View.Controls"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" x:Name="controlRoot">
    <UserControl.Resources>
        <Style TargetType="{x:Type RepeatButton}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid Name="MainGrid" Background="{TemplateBinding Background}">
                            <Viewbox>
                                <Border BorderBrush="LightSlateGray" BorderThickness="0" CornerRadius="1" Padding="1">
                                    <ContentPresenter Margin="{TemplateBinding Control.Padding}"
                                          HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                                          SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
                                          ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                                          RecognizesAccessKey="True"
                                          Content="{TemplateBinding ContentControl.Content}" />
                                </Border>
                            </Viewbox>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Border BorderThickness="0" BorderBrush="LightSlateGray" CornerRadius="1" Background="White" >
        <Grid Width="Auto" Height="Auto" x:Name="rootGrid" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.Column="0" Height="Auto">
                <local:ClickSelectTextBox x:Name="value" BorderThickness="0" Margin="0,1,0,0" TextAlignment="Left" 
                                        KeyDown="value_KeyDown">
                    <Binding ElementName="controlRoot" Path="Text" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" TargetNullValue="{x:Static sys:String.Empty}"/>
                </local:ClickSelectTextBox>
            </Grid>
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <RepeatButton Name="innerUpButton" Margin="0,1,1,0" Grid.Row="0" FocusVisualStyle="{x:Null}" Background="GhostWhite" 
                              KeyboardNavigation.IsTabStop="False" Click="innerUpButton_Click" KeyDown="innerUpButton_KeyDown">
                    <Path Fill="DarkSlateGray" Data="M 0 4 L 8 4 L 4 0 Z"/>
                </RepeatButton>
                <RepeatButton Name="innerDownButton" Margin="0,0,1,1" Grid.Row="1" FocusVisualStyle="{x:Null}" Background="GhostWhite"
                              KeyboardNavigation.IsTabStop="False" Click="innerDownButton_Click" KeyDown="innerDownButton_KeyDown" >
                    <Path Fill="DarkSlateGray" Data="M 0 0 L 4 4 L 8 0 Z"/>
                </RepeatButton>
            </Grid>
            <Grid Grid.Column="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <RepeatButton Name="outerUpButton" Margin="0,1,1,0" Grid.Row="0" FocusVisualStyle="{x:Null}" Background="GhostWhite" 
                              KeyboardNavigation.IsTabStop="False" Click="outerUpButton_Click" KeyDown="outerUpButton_KeyDown">
                    <Path Fill="DarkSlateGray" Data="M 0 4 L 8 4 L 4 0 Z"/>
                </RepeatButton>
                <RepeatButton Name="outerDownButton" Margin="0,0,1,1" Grid.Row="1" FocusVisualStyle="{x:Null}" Background="GhostWhite"
                              KeyboardNavigation.IsTabStop="False" Click="outerDownButton_Click" KeyDown="outerDownButton_KeyDown" >
                    <Path Fill="DarkSlateGray" Data="M 0 0 L 4 4 L 8 0 Z"/>
                </RepeatButton>
            </Grid>
        </Grid>
    </Border>
</local:NumericSpinnerControlBase>
